package com.itheima.d2_collection_nesting;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;

/*
      目标：理解集合的嵌套。
      江苏省 = "南京市","扬州市","苏州市","无锡市","常州市"
      湖北省 = "武汉市","孝感市","十堰市","宜昌市","鄂州市"
      河北省 = "石家庄市","唐山市", "邢台市", "保定市", "张家口市"
 */
public class Test {
    public static void main(String[] args) {
        //创建map进行存储
        HashMap<String, ArrayList<String>> map = new HashMap<>();
        //创建城市集合
        ArrayList<String> js = new ArrayList<>();
        Collections.addAll(js,"南京市","扬州市","苏州市","无锡市","常州市");
        ArrayList<String> hb = new ArrayList<>();
        Collections.addAll(hb,"武汉市","孝感市","十堰市","宜昌市","鄂州市");
        ArrayList<String> hg = new ArrayList<>();
        Collections.addAll(hg,"石家庄市","唐山市", "邢台市", "保定市", "张家口市");
        //组装数据
        map.put("江苏省",js);
        map.put("湖北省",hb);
        map.put("河北省",hg);
        //遍历
        map.forEach((k,v)->{
            System.out.print(k + ":");
            for(String s:v){
                System.out.print(s + " ");
            }
            System.out.println();
        });
    }
}
